<div class="popup_body">
    <div class="search">
        <div class="float_right">
            <button class="btn btn_yellow" id="query_${pid}">搜索</button>
        </div>
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td align="right">电池组序号：</td>
                <td><input type="text" class="text" id="packNo_${pid}"/></td>
            </tr>
        </table>
    </div>
    <div style="width:550px;height:420px; padding-top: 6px;">
        <table id="page_table_${pid}">
        </table>
    </div>
</div>
<div class="popup_btn">
    <button class="btn btn_red" id="ok_${pid}">确定</button>
    <button class="btn btn_border" id="close_${pid}">关闭</button>
</div>
<script>
    (function() {
        var win = $('#${pid}'), windowData = win.data('windowData');

        $('#page_table_${pid}').datagrid({
            fit: true,
            width: '100%',
            height: '100%',
            striped: true,
            pagination: true,
            url: "${contextPath}/security/hdw/battery_pack/page.htm",
            fitColumns: true,
            pageSize: 10,
            pageList: [10, 50, 100],
            idField: 'id',
            singleSelect: true,
            selectOnCheck: false,
            checkOnSelect: false,
            autoRowHeight: false,
            rowStyler: gridRowStyler,
            columns: [
                [
                    {
                        title: '电池组序号',
                        align: 'center',
                        field: 'packNo',
                        width: 60
                    },
                    {
                        title: '厂商',
                        align: 'center',
                        field: 'supplierName',
                        width: 60
                    }
                ]
            ],
            onLoadSuccess: function () {
                $('#page_table_${pid}').datagrid('clearChecked');
                $('#page_table_${pid}').datagrid('clearSelections');
            }
        });

        $('#ok_${pid}').click(function () {
            var selected = $('#page_table_${pid}').datagrid('getSelected');
            if (selected) {
                windowData.ok(selected);
                $('#${pid}').window('close');
            } else {
                $.messager.alert('提示信息', '请选择电池组序号');
            }

        });
        $('#close_${pid}').click(function () {
            $('#${pid}').window('close');
        });
        $('#query_${pid}').click(function () {
            query_${pid}();
        });

    })()

    function query_${pid}() {
        $('#page_table_${pid}').datagrid('options').queryParams = {
            packNo: $('#packNo_${pid}').val()
        };
        $('#page_table_${pid}').datagrid('load');
    }

</script>